/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Inode based directory notification for Linux
 *
 * Copyright (C) 2005 John McCutchan
 */
#ifndef _LINUX_INOTIFY_H
#define _LINUX_INOTIFY_H

#include <linux/sysctl.h>
#include <uapi/linux/inotify.h>
#ifdef CONFIG_RTOS_INOTIFY_TRACER
#include <linux/fsnotify_backend.h>
#endif

extern struct ctl_table inotify_table[]; /* for sysctl */

#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
			  IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
			  IN_MOVED_TO | IN_CREATE | IN_DELETE | \
			  IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
			  IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
			  IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
			  IN_MASK_CREATE | IN_ISDIR | IN_ONESHOT)

#ifdef CONFIG_RTOS_INOTIFY_TRACER
typedef void (*rtos_fm_handler_func)(struct fsnotify_group *group,
				     struct inode *inode,
				     struct fsnotify_mark *inode_mark,
				     struct inotify_event *event,
				     const char *name);
extern int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg);
extern struct fsnotify_group *init_inotify_group(rtos_fm_handler_func handler);
extern int group_rm_watch(struct fsnotify_group *group, int wd);
extern void destroy_inotify_group(struct fsnotify_group *group);
#endif
#endif	/* _LINUX_INOTIFY_H */
